﻿

namespace EveKillboard.Core
{
    using Base;
    using System.Globalization;
    using System.ComponentModel.DataAnnotations;

    [Table("KillmailItems")]
    public class KillmailItem : KillmailItemBase
    {
        [Key]
        [Column("ID")]
        public override int Id { get; set; }
        [Column("KillmailID")]
        public override int KillmailId { get; set; }
        [Column("ItemID")]
        public override int? ItemId { get; set; }
        [Column("IsCargo")]
        public override bool Cargo { get; set; }
        [Column("IsImplant")]
        public override bool Implant { get; set; }
        [Column("IsDronebay")]
        public override bool DroneBay { get; set; }
        [Column("IsDestroyed")]
        public override bool IsDestroyed { get; set; }
        [Column("IsDropped")]
        public override bool IsDropped { get; set; }
        [Column("IsShip")]
        public override bool IsShip { get; set; }
        [Column("IsCopy")]
        public override bool IsCopy { get; set; }
        [Column("Quantity")]
        public override int Quantity { get; set; }

        public virtual Killmail Killmail { get; set; }
        public virtual Item Item { get; set; }

        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5}",
                           Item.Name,
                           Quantity > 1 ? string.Format(CultureInfo.InvariantCulture, ", Qty: {0}", Quantity) : null,
                           Cargo ? " (Cargo)" : null,
                           DroneBay ? " (Drone Bay)" : null,
                           Implant ? " (Implant)" : null,
                           IsCopy ? " (Copy)" : null);
  
        }
    }
}